    var prefix = "/basTeaching";
    //var moduleFlag = '[[${moduleFlag}]]';

    $(function () {
        load();
        $("#btn-search").click(function(){
            $("#exampleTable").bootstrapTable('refresh');
        });
    });

    function load() {
        $('#exampleTable').bootstrapTable(
            {
                method: 'post',
                url: prefix + "/list.do",
                iconSize: 'outline',
                toolbar: '#exampleToolbar',
                striped: true,
                dataType: "json",
                pagination: true,
                clickToSelect: true,
                pageSize: 10,
                pageNumber: 1,
                showColumns: false,
                sidePagination: "server",
                paginationLoop: false,
                contentType: "application/x-www-form-urlencoded",
                queryParams: function (params) {
                    return {
                        tCode: $("#query_pcode").val(),
                        limit: params.limit,
                        offset: params.offset
                    };
                },
                onClickRow:function(row, $element){
                    $element.addClass('info').siblings().removeClass('info').end();
                },
                /* onDblClickRow: function (row, $element, field) {
                     view(row.id);
                 },*/
                columns: [
                    {
                        field: 'idx',
                        formatter: orderFormatter,
                        title: '序号',
                        align: 'center',
                        width: '40'
                    },
                    {
                        field: 'tcode',
                        title: '教员'
                    },
                    {
                        field: 'scode',
                        title: '被带飞人'
                    },
                    {
                        field: 'startDate',
                        title: '开始日期'
                    },
                    {
                        field: 'endDate',
                        title: '结束日期'
                    },
                    {
                        field: 'accomHrs',
                        title: '带飞小时'
                    },
                    {
                        field: 'accomUds',
                        title: '带飞起落'
                    },
                    {
                        field: 'remarks',
                        title: '说明'
                    },
                    {
                        title: '操作',
                        align: 'center',
                        visible: isShowOperation(),
                        formatter: function (value, row, index) {
                            return [
                                '<a class="' + p_edit + '" href="#" title="编辑" onclick="edit(\'' + row.teachId + '\')">',
                                '<i class="glyphicon glyphicon-edit"></i>',
                                '</a>&nbsp;&nbsp;',
                                '<a class="' + p_delete + '" href="#" title="删除" onclick="remove(\'' + row.teachId + '\')">',
                                '<i class="glyphicon glyphicon-remove  text-danger"></i>',
                                '</a>&nbsp;&nbsp;'
                            ].join('');
                        }
                    }]
            })
    }

    //是否有权限显示 '操作' 列
    function isShowOperation() {
        return (p_edit != 'hidden' || p_delete != 'hidden');
    }

    //刷新
    function reload() {
        $("#query_pcode").val("");
        $("#exampleTable").bootstrapTable('refresh');
    }

    //增加
    function add() {
        layer.open({
            type: 2,
            title: '新增',
            shadeClose: false, // 点击遮罩关闭层
            area: ['500px', '400px'],
            content : prefix + '/add.do'
        });
    }

    //编辑
    function edit(teachId) {
        layer.open({
            type: 2,
            title: '编辑',
            shadeClose: false, // 点击遮罩关闭层
            area: ['500px', '400px'],
            content: prefix + '/edit.do?id=' + teachId
        });
    }

    //查看
    function view(teachId) {
        layer.open({
            type: 2,
            title: '查看',
            shadeClose: false, // 点击遮罩关闭层
            area: ['500px', '400px'],
            content: prefix + '/view.do?id=' + teachId
        });
    }

    //删除
    function remove(teachId) {
        layer.confirm('确定要删除选中的记录？', {
            btn: ['确定', '取消']
        }, function () {
            $.ajax({
                url: prefix + "/delete.do" ,
                type: "post",
                data: {
                    'id': teachId
                },
                success: function (r) {
                    if (r.code == 0) {
                        layer.msg(r.msg);
                        reload();
                    } else {
                        layer.msg(r.msg);
                    }
                }
            });
        })
    }